<?php

class Helper_AdminPanel
{
    public $view;
    
    public function setView(Zend_View_Interface $view)
    {
        $this->view = $view;
    }

    function adminPanel()
    {
        $output='';
        
        $user=Zend_Registry::get('user');
            
        if ($user->isLogged() && $user->role == Application_Model_UserRoles::getAdminRole())   
        {
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('user/list').'">'.Zend_Registry::get('locale')->_("Users").'</a>');
           
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('node/list').'">'.Zend_Registry::get('locale')->_('Nodes').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('node/add').'">'.Zend_Registry::get('locale')->_('Create node').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('file/list').'">'.Zend_Registry::get('locale')->_('Files').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('file/add').'">'.Zend_Registry::get('locale')->_('Upload file').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('search/update').'">'.Zend_Registry::get('locale')->_('Start index').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('search/optimize').'">'.Zend_Registry::get('locale')->_('Optimize index').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('search/clear').'">'.Zend_Registry::get('locale')->_('Clear index').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('log/stat').'">'.Zend_Registry::get('locale')->_('Statistics').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('log/list').'">'.Zend_Registry::get('locale')->_('Access log').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('log/clear').'">'.Zend_Registry::get('locale')->_('Clear log').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('clear').'">'.Zend_Registry::get('locale')->_('Clear cache').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('tags').'">'.Zend_Registry::get('locale')->_('Tags').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('tags/add').'">'.Zend_Registry::get('locale')->_('Add tag').'</a>');
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('parse').'">'.Zend_Registry::get('locale')->_('Tags parser').'</a>');
            
            $this->view->placeholder('adminpanel')->append('<a href="'.$this->view->fixUrl('user/logout').'">'.Zend_Registry::get('locale')->_('Logout').'</a>');
        
            $output=$this->view->placeholder('adminpanel');
        }

        return $output;
    }
}
